package jude.java.money.scan;

import jude.java.framework.beans.Regexp;

public class YahooBacklinkSiteScanner extends LimitSiteScaner {
	
//	private static final String[] PATTERNS = {
//		"title=\"(http://[^\"]{4,200})\"",
//		"<a\\sclass=\"btn\"\\shref=\"http://siteexplorer\\.search\\.yahoo\\.com/search;[^\"]+\">"
//	};
	
	private Regexp[] regexps;
	
	public YahooBacklinkSiteScanner(String... urls) {
		super(urls);
		regexps = new Regexp[2];
		regexps[0] = new Regexp("title=\"", "http://[^\"]{4,200}", "\"", 0, PATTERN_TYPE_SITE);
		regexps[1] = new Regexp("<a class=\"btn\" href=\"", "http://siteexplorer\\.search\\.yahoo\\.com/search;[^\"]+", "\"", 0, PATTERN_TYPE_RELATIVE);
	}

	@Override
	protected boolean denied(StringBuilder content) {
		// TODO Auto-generated method stub
		return super.denied(content);
	}
	
	@Override
	protected String getKey(String url) {
		int i = url.lastIndexOf('=');
		String key = url.substring(i);
		return key;
	}
	
	@Override
		protected boolean decodeUrl() {
			return true;
		}
	
	@Override
	protected Regexp[] getPatterns() {
		return regexps;
	}
	
//	@Override
//	protected String[] getUrlPatterns() {
//		return new String[] {URL_PATTERN};
//	}
}
